package com.fjl.factoryBean;

import com.fjl.ConfigApp;
import com.fjl.service.TestService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestFactorybean {
	public static void main(String[] args) {
		ApplicationContext ac = new AnnotationConfigApplicationContext("com.fjl");
//		ApplicationContext ac = new AnnotationConfigApplicationContext(ConfigApp.class);
		try {
			MyService bean = ac.getBean(MyService.class);
			MyService bean2 = (MyService) ac.getBean("myService");
			MyServiceFactoryBean factory = (MyServiceFactoryBean) ac.getBean("&myService");
			System.out.println(factory.getClass());

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
